﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

using Microsoft.Xna.Framework.Graphics;
using AimGameLibrary;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretySpriteEffects : Form
    {
        NodeSpriteEffects nodespriteeffects;
        public PropretySpriteEffects(NodeSpriteEffects nodespriteeffects)
        {
            InitializeComponent();
            this.nodespriteeffects = nodespriteeffects;

            foreach (string str in Enum.GetNames(nodespriteeffects.myeffects.GetType()))
                this.comboBox1.Items.Add(str);

            this.comboBox1.SelectedItem = nodespriteeffects.myeffects.ToString();

            this.comboBox2.Items.Add(NodeInputMode.None.ToString());
            this.comboBox2.Items.Add(NodeInputMode.SpriteEffects_1.ToString());
            this.comboBox2.SelectedItem = nodespriteeffects.InputMode.ToString();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            String temp = (String)this.comboBox1.SelectedItem;

            if (temp == SpriteEffects.None.ToString())
                nodespriteeffects.myeffects = SpriteEffects.None;
            else if (temp == SpriteEffects.FlipHorizontally.ToString())
                nodespriteeffects.myeffects = SpriteEffects.FlipHorizontally;
            else if (temp == SpriteEffects.FlipVertically.ToString())
                nodespriteeffects.myeffects = SpriteEffects.FlipVertically;

            nodespriteeffects.SetupProprety();
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            String temp = (String)this.comboBox2.SelectedItem;
            if (temp == NodeInputMode.None.ToString())
            {
                comboBox1.Enabled = true;
                nodespriteeffects.InputMode = NodeInputMode.None;
            }
            else if (temp == NodeInputMode.SpriteEffects_1.ToString())
            {
                comboBox1.Enabled = false;
                nodespriteeffects.InputMode = NodeInputMode.SpriteEffects_1;
            }
        }


    }
}
